<template>
    <div class="mui-numbox" data-numbox-step="1" data-numbox-min="1">
        <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
        <!--@change监听数据改变-->
        <input class="mui-input-numbox" type="number" :value="goodCount" ref="numbox" @change="updataCount">
        <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
    </div>

</template>

<script>
 import mui from '../../lib/dist/js/mui.min.js'

    export default {
        data(){
            return{}
        },
        mounted(){
            mui(".mui-numbox").numbox();
        },
        methods:{
            //将最新的数量更新到本地
            updataCount(){
                var newNum = this.$refs.numbox.value;
                console.log(newNum);
                this.$store.commit('updateGoodsInfo',{
                    id:this.goodID,
                    countNew:newNum
                });
            }
        },
        props:['goodCount','goodID']
    }
</script>

<style scoped>

</style>